//
//  WithdrawSelectCell.swift
//  d11
//
//  Created by peale on 2018/11/15.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit

class WithdrawSelectCell: UITableViewCell {
    var bgImgView : UIImageView?
    var iconImgView : UIImageView?
    var titleLabel : UILabel?
     var subTitleLabel : UILabel?
    var arrowImgView : UIImageView?
    var lineView : UIView?
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.backgroundColor  = UIColor.clear
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        // self.contentView!.backgroundColor  = UIColor.clear
        self.bgImgView = UIImageView.init()
        self.bgImgView?.image = imageNamed("icon_my_cell_item")
        self.bgImgView?.isUserInteractionEnabled = true
        self.contentView.addSubview(bgImgView!);
        self.bgImgView?.snp.makeConstraints{(make) in
            make.width.equalToSuperview().offset(-20)
            make.height.equalTo(60)
            make.centerX.equalTo(self.contentView)
        };
        
        self.iconImgView = UIImageView.init()
        self.iconImgView?.image = imageNamed("icon_withdraw_bank_name")
        self.bgImgView?.addSubview(self.iconImgView!)
        self.iconImgView?.snp.makeConstraints{(make) in
            make.left.equalToSuperview().offset(15)
            make.width.equalTo(20)
            make.height.equalTo(20)
            make.centerY.equalTo(self.bgImgView!)
        }
        self.titleLabel = UILabel.init()
        self.titleLabel?.text = "请选择银行种类"
        self.titleLabel?.textColor = HexRGBAlpha(0x333333, 1)
        self.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.titleLabel?.textAlignment = NSTextAlignment.left
        self.bgImgView?.addSubview(self.titleLabel!)
        
        self.titleLabel?.snp.makeConstraints{(make) in
            make.left.equalTo((self.iconImgView?.snp.right)!).offset(15)
            make.width.equalTo(130)
            make.height.equalTo(51)
            make.centerY.equalToSuperview()
        }
        
        
        self.arrowImgView = UIImageView.init()
        self.arrowImgView?.image = imageNamed("icon_depoist_cell_arrow")
        self.bgImgView?.addSubview(self.arrowImgView!)
        
        self.arrowImgView?.snp.makeConstraints{(make) in
            make.right.equalToSuperview().offset(-12)
            make.width.equalTo(9)
            make.centerY.equalTo(self.bgImgView!)
            make.height.equalTo(15)
        }
        
        self.subTitleLabel = UILabel.init()
        self.subTitleLabel?.text = "请选择银行卡"
        self.subTitleLabel?.textColor = HexRGBAlpha(0x999999, 1)
        self.subTitleLabel?.font = UIFont.systemFont(ofSize: 14)
        self.subTitleLabel?.textAlignment = NSTextAlignment.right
        self.bgImgView?.addSubview(self.subTitleLabel!)
        
        self.subTitleLabel?.snp.makeConstraints{(make) in
            make.left.equalTo((self.titleLabel?.snp.right)!)
            make.right.equalTo((self.arrowImgView?.snp.left)!).offset(-12)
            make.height.equalTo(51)
            make.centerY.equalToSuperview()
        }
    }
    
    func setData(bankName:String?) -> Void {
        if bankName == nil {
             self.subTitleLabel?.text = "请选择银行种类"
        }else{
             self.subTitleLabel?.text = bankName ?? ""
        }
       
    }

}
